package com.weather.controller;


import org.springframework.web.bind.annotation.*;
import com.weather.websocket.WebSocketHandler;

@RestController
@RequestMapping("/test")
public class TestWebSocketController {

    @GetMapping("/notifyUser")
    public String notifyUser(@RequestParam String userId) {
        String json = "{\"type\":\"chatUpdate\",\"content\":\"你有新消息啦\"}";
        WebSocketHandler.sendMsgToUser(userId, json);
        return "已通知用户：" + userId;
    }
}
